Deduplicating malware

ABSTRACT

Detecting duplicate malware samples is disclosed. A first guest clock is set to a first value in a first virtual machine instance. A first malware sample is executed in the first virtual machine instance. A second guest clock value is set to the first value in a second virtual machine instance. A second malware sample is executed in the second virtual machine instance. A determination is made as to whether the first malware sample and the second malware sample are the same, based at least in part on performing a comparison of attempted external contacts generated by executing each of the respective first and second malware samples.

CROSS REFERENCE TO OTHER APPLICATIONS

This application is a continuation of co-pending U.S. patent application Ser. No. 14/575,963, entitled DEDUPLICATING MALWARE filed Dec. 18, 2014 which is incorporated herein by reference for all purposes.

BACKGROUND OF THE INVENTION

Nefarious individuals attempt to compromise computer systems in a variety of ways. As one example, such individuals may embed or otherwise include malicious software (“malware”) in email attachments and transmit or cause the malware to be transmitted to unsuspecting users. When executed, the malware compromises the victim's computer. Some types of malware will instruct a compromised computer to communicate with a remote host. For example, malware can turn a compromised computer into a “bot” in a “botnet,” receiving instructions from and/or reporting data to a command and control (C&C) server under the control of the nefarious individual. One approach to mitigating the damage caused by malware is for a security company (or other appropriate entity) to attempt to identify malware and prevent it from reaching/executing on end user computers. Another approach is to try to prevent compromised computers from communicating with the C&C server. Unfortunately, malware authors are using increasingly sophisticated techniques to obfuscate the workings of their software. Accordingly, there exists an ongoing need for improved techniques to detect malware and prevent its harm.

BRIEF DESCRIPTION OF THE DRAWINGS

Various embodiments of the invention are disclosed in the following detailed description and the accompanying drawings.

FIG. 1 illustrates an example of an environment in which malware is detected and its harm reduced.

FIG. 2 illustrates an embodiment of a data appliance.

FIG. 3 illustrates an example of logical components that can be included in a system for analyzing candidate malware.

FIG. 4 illustrates an embodiment of a process for collecting algorithmically generated domains.

FIG. 5 illustrates an embodiment of a process for detecting duplicate malware samples.

DETAILED DESCRIPTION

The invention can be implemented in numerous ways, including as a process; an apparatus; a system; a composition of matter; a computer program product embodied on a computer readable storage medium; and/or a processor, such as a processor configured to execute instructions stored on and/or provided by a memory coupled to the processor. In this specification, these implementations, or any other form that the invention may take, may be referred to as techniques. In general, the order of the steps of disclosed processes may be altered within the scope of the invention. Unless stated otherwise, a component such as a processor or a memory described as being configured to perform a task may be implemented as a general component that is temporarily configured to perform the task at a given time or a specific component that is manufactured to perform the task. As used herein, the term ‘processor’ refers to one or more devices, circuits, and/or processing cores configured to process data, such as computer program instructions.

A detailed description of one or more embodiments of the invention is provided below along with accompanying figures that illustrate the principles of the invention. The invention is described in connection with such embodiments, but the invention is not limited to any embodiment. The scope of the invention is limited only by the claims and the invention encompasses numerous alternatives, modifications and equivalents. Numerous specific details are set forth in the following description in order to provide a thorough understanding of the invention. These details are provided for the purpose of example and the invention may be practiced according to the claims without some or all of these specific details. For the purpose of clarity, technical material that is known in the technical fields related to the invention has not been described in detail so that the invention is not unnecessarily obscured.

FIG. 1 illustrates an example of an environment in which malware is detected and its harm reduced. In the example shown in FIG. 1, a malicious individual (using system 120) has created malware 130. The malicious individual hopes that a client device, such as client device 104, will execute a copy of malware 130, compromising the client device, and causing the client device to become a bot in a botnet. The compromised client device can then be instructed to perform tasks (e.g., cryptocurrency mining, or participating in denial of service attacks) and to report information to an external entity, such as command and control (C&C) server 150, as well as to receive instructions from C&C server 150, as applicable.

Suppose C&C server 150 is reachable by the domain “kjh2398sdfj.com,” which the malware author registered on a Monday morning (e.g., at 00:01) using a stolen identity/credit card information. While malware 130 could explicitly include the domain “kjh2398sdfj.com” in its code, techniques such as static/dynamic analysis of malware 130 (described in more detail below) could make it possible for a security company (or other applicable entity, such as a security researcher) to identify the domain “kjh2398sdfj.com” as a C&C server, and take remedial actions (e.g., publish the domain “kjh2398sdfj.com” on a blacklist, and/or act to get the C&C server shut down/made unreachable). Further, if the domain “kjh2398sdfj.com” is hard coded into malware 130, once C&C server 150 is shut down, the malware author will potentially be unable to switch the command and control server used by malware 130 (e.g., switch the malware from contacting “kjh2398sdfj.com” to another, still reachable domain)—making the malware less useful to the malware author.

Instead of hard coding the domain “kjh2398sdfj.com” into malware 130, another approach is for the malware author to make use of algorithmically generated domains (“AGDs”). With AGDs, instead of trying to contact a specific, predetermined domain, malware 130 can programmatically generate multiple domain names and try to connect to each generated name in turn, until a successful connection is made. Further, the malware can continue to generate domain names, so that in the event “kjh2398sdfj.com” becomes no longer reachable, the malware can successfully contact the C&C server at a new domain.

In the following example, suppose malware 130 uses client device 104's system clock time as a seed, generates an ASCII string every five minutes, and then attempts to connect to the generated string (after adding an appropriate top level domain to the string, such as .com, as applicable). Malware 130 (e.g., when executing on a client device, such as client device 104) first generates “dwk2648vkwh.com” and attempts to connect to it Monday morning at 00:00. Since the malware author did not register “dwk2648vkwh.com” (and C&C server 150 is not reachable via “dwk2648vkwh.com”), no connection will be made to C&C server 150 by client device 104 via “dwk2648vkwh.com.” At the next five minute mark, malware 130 (e.g., when executing on client device 104) will generate the domain “gwd4734qj5i.com” and attempt to connect to that domain (e.g., at 00:05). Malware 130 will continue generating domain names every five minutes (and attempting to connect to those domain names) until (e.g., at 01:15) it generates and is able to connect to “kjh2398sdfj.com” (which the malware author registered and brought online at 00:01 Monday).

Typically, a malware author will use a first domain (e.g., “kjh2398sdfj.com”) for a period of time, such as two or three days (or a week), and then periodically switch the C&C server (or bring up other C&C servers, as applicable) to a new domain (e.g., “43hfd83hd3.com”) to thwart efforts to shut the C&C server down/block access to the C&C server. The malware's domain generation algorithm will correspondingly generate the appropriate new, reachable, C&C domains (e.g., “43hfd83hd3.com”) as well as other domains (e.g., every five minutes) that the author will not register—rotating through domain names the malware will use to successfully reach an appropriate C&C server. Since the author of malware 130 selected the domain generation algorithm (DGA) used by malware 130, the malware author is able to programmatically determine which domains will be generated by compromised machines (and at what date/time malware copies will attempt to communicate with those generated domains), and can therefore register a single appropriate domain for C&C use for a given time period. Typically, the malware author will register a new domain just before the domain is needed (e.g., within hours of when clients executing the domain generation algorithm would potentially start trying to connect to “43hfd83hd3.com”).

The AGDs generated by malware 130 appear (e.g., to a researcher or other observer) seemingly random, and as such are problematic for security companies, particularly where a large number of domains are generated within a short period of time by the malware. If a security company is able to determine how the AGDs are generated by a particular piece of malware, the security company could potentially take remedial actions with respect to those domains. Unfortunately, malware authors typically obfuscate their domain generation algorithms, and do so at a level of sophistication that makes reverse engineering the malware (and domain generation algorithm) in a timely manner difficult, if not impossible. For example, a talented security researcher may need to expend months of effort to reverse engineer a single domain generation algorithm. In contrast, malware authors can modify the workings of their domain generation algorithms with relative ease/speed (e.g., changing the algorithm each week). By the time the researcher has discovered how the domain generation algorithm works, the malware author can easily have switched to a new algorithm, meaning the researcher will likely have to start analysis of the new algorithm from scratch—again taking potentially months to discover how the new algorithm works. As will be described in more detail below, using techniques described herein, the AGDs used by malware, such as malware 130, can be efficiently collected, and a variety of remedial actions taken in response to their collection, without requiring a researcher to determine (e.g., via reverse engineering) how the algorithm used to generate the AGDs works.

Returning to the example shown in FIG. 1, suppose client devices 104-108 are a laptop computer, a desktop computer, and a tablet (respectively) present in an enterprise network 110 (belonging to the “Acme Company”). Data appliance 102 is configured to enforce policies regarding communications between clients, such as clients 104 and 106, and nodes outside of enterprise network 110 (e.g., reachable via external network 118). Examples of such policies include ones governing traffic shaping, quality of service, and routing of traffic. Other examples of policies include security policies such as ones requiring the scanning for threats in incoming (and/or outgoing) email attachments, website downloads, files exchanged through instant messaging programs, and/or other file transfers. In some embodiments, appliance 102 is also configured to enforce policies with respect to traffic that stays within enterprise network 110.

Appliance 102 can take a variety of forms. For example, appliance 102 can comprise a dedicated device or set of devices. The functionality provided by appliance 102 can also be integrated into or executed as software on a general purpose computer, a computer server, a gateway, and/or a network/routing device. In some embodiments services provided by data appliance 102 are instead (or in addition) provided to client 104 by software executing on client 104.

Whenever appliance 102 is described as performing a task, a single component, a subset of components, or all components of appliance 102 may cooperate to perform the task. Similarly, whenever a component of appliance 102 is described as performing a task, a subcomponent may perform the task and/or the component may perform the task in conjunction with other components. In various embodiments, portions of appliance 102 are provided by one or more third parties. Depending on factors such as the amount of computing resources available to appliance 102, various logical components and/or features of appliance 102 may be omitted and the techniques described herein adapted accordingly. Similarly, additional logical components/features can be included in embodiments of system 102 as applicable.

As will be described in more detail below, appliance 102 can be configured to work in cooperation with one or more virtual machine servers (112, 124) to perform malware analysis/prevention. As one example, data appliance 102 can be configured to provide a copy of malware 130 to one or more of the virtual machine servers for real-time analysis, in which the malware is executed in an instrumented virtual environment (e.g., where various user level hooks and/or kernel level hooks in an execution environment emulated in a virtual environment facilitate the monitoring of various program behaviors during execution in the virtual environment). As another example, service 122 can provide a list of signatures of known-malicious files to appliance 102 as part of a subscription. Those signatures can be generated by service 122 in conjunction with the techniques described herein. As yet another example, and as will be described in more detail below, results of analysis performed by the virtual machine servers can be used to generate/maintain blacklists of domains determined (or suspected) to be algorithmically generated by malware, and/or to take other actions, such as registering the algorithmically generated domains before the malware author does (thereby preventing the malware author from registering/using the algorithmically generated domain).

In various embodiments, data appliance 102 includes a DNS module 134, which is configured to receive a blacklist of known/suspected AGDs and prevent connections (e.g., by client devices 104-108) to those domains. DNS module 134 can be integrated into appliance 102 (as shown in FIG. 1) and can also operate as a standalone appliance in various embodiments. And, as with other components shown in FIG. 1, DNS module 134 can be provided by the same entity that provides appliance 102 (or cloud security service 122), and can also be provided by a third party (e.g., one that is different from the provider of appliance 102 or cloud security service 122). Further, instead of/in addition to preventing connections to known/suspected AGDs, DNS module 134 can take other actions, such as logging attempts by clients to access known/suspected AGDs on a blacklist (an indication that a given client is compromised and should be quarantined, or otherwise investigated by an administrator). DNS module 134 can perform other/additional services as well. As one example, DNS module 134 can be configured to monitor DNS requests (e.g., as received from client devices such as client device 104) for evidence that the client device has been infected with malware that makes use of algorithmically generated domains (e.g., where those domains are not already on a blacklist). As one example, DNS module 134 can employ statistical/heuristic analysis to DNS requests received from clients (e.g., examining for entropy in the requested domain names), and, when DNS module 134 determines the requests are suspicious (e.g., meet a threshold set of criteria), remedial actions can be taken with respect to the client device.

An example of a virtual machine server is a physical machine comprising commercially available server-class hardware (e.g., a multi-core processor, 64+ Gigabytes of RAM, and one or more Gigabit network interface adapters) that runs commercially available virtualization software, such as VMware ESXi, Citrix XenServer, Kernel Based Virtual Machine (KVM), or Microsoft Hyper-V. The virtual machine server can be configured to run a customized hypervisor (whether as a modified version of a commercially-available hypervisor, or a custom-built hypervisor). The customizations allow the virtualization platform to speed up the passage of time, as viewed from the perspective of the executing malware (running in a guest system of the host), without the malware being aware that timing has been altered. As will be described in more detail below, by accelerating timer interrupts when the guest is idle, and maintaining the consistency of the guest's clocks, the guest will skip wait states, radically accelerate execution of the sample. By setting the guest clock to a time in the future or past, DGA malware will produce the appropriate domain names for that time, and those domain names can be collected for a variety of purposes.

Two examples of hypervisor customizations are as follows: The HLT instruction (also referred to herein as a HALT instruction) on the x86 platform causes the processor to put all non-essential parts to sleep to save power, and do nothing until the next hardware interrupt (e.g., a keyboard press, or the scheduler timer expires). The scheduler will try to remain in the HALTed state as much as possible if it determines that the user is idle and there is no batch processing to do. Virtualization platforms typically emulate HALT instructions by using a sleep( ) call (e.g., with sleep(500) in a process yielding time for the next 500 seconds to the platform). A first customization of the hypervisor is that, whenever the instruction dispatcher routine receives a HALT instruction, instead of sleep( )ing for a given period of time (e.g., specified by the call, such as 500 seconds), the sleep is set to zero seconds (making the HALT into a NOP) or another, shorter amount of time. This modification is also referred to herein as a “time interrupt” modification. A second customization of the hypervisor is also referred to herein as a “time polling” modification. In this second customization, the hypervisor is modified to intercept access to time values read from memory or a register—supplying an alternate, monotonically increasing value. As long as the times supplied by the hypervisor are consistent across the various time sources, guest software will still run correctly (and the malware will not notice/detect the customized time). The two modifications can also be used in conjunction, such that the various guest time sources are advanced by an amount corresponding to the amount of time originally specified in a sleep call. So, for example, if a sleep call of 500 seconds is received, and a sleep of zero seconds is instead performed, the various guest system time sources are advanced by their respective notions of 500 seconds.

In various embodiments, the guest system time sources comprise synthetic hardware time sources that the guest can query to get a time source. Each guest system time source in turn queries a time source made available by the hypervisor, and the customized hypervisor applies an appropriate transformation (e.g., of the host time) to provide a suitable, consistently erroneous time, to each type of guest time source. Examples of guest system time sources that are managed by the customized hypervisor include the realtime clock (RTC), the high precision event timer (HPET), the programmable interval timer (PIT), the timestamp counter (TSC), and the advanced programmable interrupt controller (APIC) timer. Various timers advance at different rates/frequencies, and the customized hypervisor is configured to advance each timer in accordance with its respective time keeping properties to maintain a unified guest time. When the process returns from the sleep( ) it will appear to the process that 500 seconds have elapsed, when in fact they have not (irrespective of which guest time source(s) are asked for the current guest time by the malware). Whether the malicious program is relying on number of time cycles elapsing (e.g., via sleep( ), the malicious program is reading time from a memory space (e.g., corresponding to one of the virtualized time sources), or both, the customized hypervisor can present a fabricated view of the guest time to the malicious program.

As will be described in more detail below, the hypervisor customizations will allow for the accelerated execution of the malware. The domain names that would otherwise be generated by malware 130 over the course of a day (e.g., once every five minutes when executing on a compromised client) will be generated much more quickly (e.g., once a second—or faster—when executing in the virtualized environment).

Below is an example of pseudo code for implementing a time-accelerated virtualized environment in accordance with embodiments of techniques described herein. In particular, this is an example of an instruction dispatch routine for emulating the HLT (opcode 0xf4) instruction on the Intel x86 architecture. In this example, the system can operate in one of two modes—a “TurboMode” where guest time is accelerated, and a non-TurboMode where guest time advances at the same rate as host time:

if(!IsTurboMode)){// simulate normal timing (i.e., honor sleep requests)

-   -   while(!CheckForInterrupts( ))         -   sleep(n);

}

else {// accelerate timing; advance the guest clock without sleeping.

-   -   // the GetNextInterruptTime function obtains the time when the     -   // next scheduler interrupt will fire, which is the next time         the     -   // machine will wake up to run the scheduler—which will     -   // determine if there is any work for to do. If the scheduler         finds     -   // no work, it will re-execute the HLT instruction.

nextInterruptTime=GetNextInterruptTime( ))

SetGuestClock(nextInterruptTime);

}

Returning to the example of FIG. 1, the virtual machine servers can be separate from, but in communication with, data appliance 102, as shown. A virtual machine server can also perform some or all of the functions of data appliance 102 (or the subset of functions described herein as pertaining to the collection of algorithmically generated domains), and a separate data appliance 102 omitted as applicable. Further, a virtual machine server can be under the control of the same entity that administers data appliance 102 (e.g., virtual machine server 112); the virtual machine server can also be provided by a third party (e.g., virtual machine server 124, which can be configured to provide services to appliance 102 via third party service 122). In some embodiments, data appliance 102 is configured to use one or the other of virtual machine servers 112 and 124 for malware analysis. In other embodiments, data appliance 102 is configured to use the services of both servers (and/or additional servers not pictured). Further, in various embodiments, multiple virtual machine servers are present within the same platform. For example, cloud security service 122 can make use of multiple virtual machine servers (in addition to virtual machine server 124). In yet additional embodiments, at least some virtual machine servers are provided by an entity that is different from the operator of cloud security service 122. For example, cloud security service 122 could be operated by a computer security company which makes use of third party cloud computing services, such as Amazon Web Services (AWS) to provide at least some of the computer security company's virtual machine servers. Finally, while examples are described herein as making use of virtual machine servers (e.g., to allow for a single host system executing multiple guest systems at once), the techniques described herein, and in particular, the activities described as being performed inside a guest system, can also be performed using non-virtualized hardware (e.g., to thwart anti-virtual-machine techniques employed by malware). For example, the customizations described herein as being made to a hypervisor can instead/in addition be made to an operating system running on a non-virtualized system, with DGA malware executing on the non-virtualized system and domain names collected in accordance with adaptations of the techniques described herein. For example, the operating system can be modified (or shimmed, etc., as applicable) such that time requests intended for the non-virtualized system's hardware time sources are intercepted, and an appropriately (artificially) advanced time is provided (e.g., to requesting malware). The artificially advanced time on a non-virtualized system is also referred to herein as a “virtualized time.”

FIG. 2 illustrates an embodiment of a data appliance. The example shown is a representation of physical components that are included in appliance 102, in some embodiments. Specifically, appliance 102 includes a high performance multi-core CPU 202 and RAM 204. Appliance 102 also includes a storage 210 (such as one or more hard disks), which is used to store policy and other configuration information, as well as URL information. Data appliance 102 can also include one or more optional hardware accelerators. For example, data appliance 102 can include a cryptographic engine 206 configured to perform encryption and decryption operations, and one or more FPGAs 208 configured to perform matching, act as network processors, and/or perform other tasks.

Using Virtual Machines to Analyze Files

A virtual machine (VM) can be used to perform behavior profiling (e.g., in a VM sandbox environment) using various heuristic-based analysis techniques that can be performed in real-time during a file transfer (e.g., during an active file/attachment download) and/or on files previously collected (e.g., a collection of files submitted for batch analysis). Documents, executables, and other forms of potentially malicious software (e.g., to be evaluated) are referred to herein as “samples.”

Returning to the example of FIG. 1, suppose a malicious user of system 120 sends an email message to a user of client 104 that includes a malicious attachment. The attachment may be an executable (e.g., having a .exe extension) and may also be a document (e.g., a .doc or .pdf file). The message is received by data appliance 102, which determines whether a signature for the attachment is present on data appliance 102. A signature, if present, can indicate that the attachment is known to be safe, and can also indicate that the attachment is known to be malicious, in accordance with various embodiments. If no signature for the attachment is found, data appliance 102 is configured to provide the attachment to a virtual machine server, such as virtual machine server 112 or 124, for analysis.

Virtual machine server 112 is configured to perform static analysis of samples, and also to perform dynamic analysis of samples, in which the samples are executed (or opened in an application, as applicable) in one or more virtual machine instances 114-116. The virtual machine instances may all execute the same operating system (e.g., Microsoft Windows XP SP 3), may execute different operating systems, and/or may collectively execute combinations of operating systems (and/or versions thereof) (e.g., with VM instance 116 emulating an Android operating system). In some embodiments, the VM image(s) chosen to analyze the attachment are selected to match the operating system of the intended recipient of the attachment being analyzed (e.g., where the operating system of client 104 is Microsoft Windows XP SP 2). Observed behaviors resulting from executing/opening the attachment (such as changes to certain platform, software, or registry settings, as well as any network connection attempts made) are logged and analyzed for indications that the attachment is malicious. In some embodiments, the dynamic analysis is performed in two stages. In a first stage, external domains that a given piece of malware attempts to contact (e.g., when executing in a virtual machine instance) are logged and then analyzed as a set for indications that the contact attempts are indicative of the sample algorithmically generating domain names. One approach to perform such analysis is to examine (e.g., using an entropy module) the entropy of any domains with which contact is attempted by the malware sample (e.g., with “kittens.example.com” having low entropy and “23rkjf9823r5hfd8723r5.com” having high entropy). The entropy analysis can be performed by a variety of components, such as an embodiment of dynamic analysis engine 310, coordinator 304, or a standalone entropy analysis component. A malware sample that appears to be using a domain generation algorithm can then undergo a second stage of dynamic analysis in which the domain names it generates are collected (described in more detail below, e.g., in conjunction with process 400 of FIG. 4). In some embodiments, the first stage is omitted (e.g., with all samples undergoing the second stage of dynamic analysis, and/or where a separate component or set of components has previously determined that the sample is making use of a domain generation algorithm).

In some embodiments log analysis (e.g., of results of static/dynamic analysis) is performed by the VM server (e.g., VM server 112). In other embodiments, the analysis is performed at least in part by appliance 102. The malware analysis and enforcement functionality illustrated in FIG. 1 as being provided by data appliance 102 and VM server 112 is also referred to herein as being provided by malware analysis system 132. As explained above, portions of malware analysis system 132 may be provided by multiple distinct devices, but may also be provided on a single platform, as applicable. For example, the functionality described herein (or portions thereof) as being provided by malware analysis system 132 can also be provided by cloud security service 122.

If the attachment is determined to be malicious, appliance 102 can automatically block the file download based on the analysis result. Further, a signature can be generated and distributed (e.g., to other data appliances, and/or to cloud security service 122) to automatically block future file transfer requests to download the file determined to be malicious. As mentioned above, some types of malware (also referred to herein as “DGA malware”) algorithmically generate domain names. Using techniques described herein, a list of domains generated by a piece of DGA malware can be efficiently collected (e.g., as output during static/dynamic analysis of the malware) and used in a variety of ways.

FIG. 3 illustrates an example of logical components that can be included in a system for analyzing candidate malware. System 300 can be implemented using a single physical device. System 300 can also be implemented, collectively, across multiple distinct devices. For example, when data appliance 102 works in combination with virtual machine server 112, malware analysis system 132 is an embodiment of system 300. As another example, the functionality of system 300 can be provided by cloud security service 122. As explained above, cloud security service 122 can include a single (124), or multiple virtual machine servers.

As mentioned above, a given piece of candidate malware (e.g., a potentially malicious document/file/etc.) can be received for analysis in a variety of ways. In the following discussion, malware 130 (intended for a client such as client 104 by a malware author) is received by platform 102 and a check is made (e.g., against information stored in storage 210) to determine whether malware 130 matches any signatures of known malware. Suppose in the following example that no such signature is present on platform 102, and also that no such signature is present on cloud security service 122 (where platform 102 is configured to check for the existence of a signature on service 122). Platform 102 sends a copy of malware 130 to cloud security service 122 for further analysis (e.g., before allowing it to be delivered to client device 104). In various embodiments, when a new piece of candidate malware is received for analysis (e.g., an existing signature associated with the file is not present at cloud security service 122), it is added to a processing queue 302.

Coordinator 304 monitors queue 302, and as resources (e.g., a static analysis worker) become available, coordinator 304 fetches a piece of potential malware for analysis from queue 302 for processing (e.g., fetches a copy of malware 130). In particular, coordinator 304 first provides the application to static analysis engine 306 for static analysis. In some embodiments, one or more static analysis engines are included within system 300, where system 300 is a single device. In other embodiments, static analysis is performed by a separate static analysis server that includes a plurality of workers (i.e., a plurality of instances of static analysis engine 306). In yet other embodiments, static analysis is omitted, or provided by a third party, as applicable.

The static analysis engine obtains general information about the candidate malware and includes it (along with heuristic and other information, as applicable) in a static analysis report 308. The report can be created by the static analysis engine, or by coordinator 304 (or by another appropriate component) which can be configured to receive the information from static analysis engine 306. In some embodiments, the collected information is stored in one or more database records for the candidate malware (e.g., in a database 316), instead of or in addition to a separate static analysis report 308 being created (i.e., portions of the database record form the static analysis report 308).

Once the static analysis is complete, coordinator 304 locates an available dynamic analysis engine 310 to perform dynamic analysis on the candidate malware. As with static analysis engine 306, system 300 can include one or more dynamic analysis engines directly. In other embodiments, dynamic analysis is performed by a separate dynamic analysis server that includes a plurality of workers (i.e., a plurality of instances of dynamic analysis engine 310).

Each dynamic analysis engine manages a virtual machine instance. In some embodiments, results of static analysis (e.g., performed by static analysis engine 306), whether in report form (308) and/or as stored, e.g., in database 316, are provided as input to a dynamic analysis engine 310. For example, the static analysis report information can be used to help select/customize the virtual machine instance used by dynamic analysis engine 310 (e.g. Microsoft Windows XP SP 3 vs. Windows 7 SP 2). Where multiple virtual machine instances are executed at the same time, a single dynamic analysis engine can manage all of the instances, or multiple dynamic analysis engines can be used (e.g., with each managing its own virtual machine instance), as applicable. As will be explained in more detail below, during the dynamic portion of the analysis, actions taken by the application are analyzed. For example, a list of any domains dynamically generated by the application is collected (e.g., domains which the application attempts to access that are not hard coded/were otherwise not discovered during static analysis).

In various embodiments, static analysis of candidate malware is omitted or is performed by a separate entity, as applicable. As one example, traditional static and/or dynamic analysis may be performed on files by a first entity. Once it is determined (e.g., by the first entity) that a given file is malicious, and more particularly, that the file is (or is potentially) making use of algorithmically generated domains, the file can be provided to a second entity (e.g., the operator of cloud security service 122) specifically for additional analysis with respect to the malware's use of algorithmically generated domains (e.g., by a dynamic analysis engine 310).

Collecting Algorithmically Generated Domains

FIG. 4 illustrates an embodiment of a process for collecting algorithmically generated domains. In various embodiments, process 400 is performed by system 300 (examples of which include malware analysis system 132 and cloud security service 122). The process begins at 402 when candidate malware is received. As one example, candidate malware is received at 402 when an email (including an attachment) is received by data appliance 102 from system 120. As another example, data appliance 102 can be configured to transmit the attachment to service 122 for analysis. In that scenario, the candidate malware is received by service 122 at 402. As yet another example, candidate malware can be received at 402 as part of a batch operation (e.g., where cloud security service 122 receives a variety of malware samples over a period of time and a batch of received samples is provided to virtual machine server 124 for processing—with virtual machine server 124 receiving the batch at 402). Further, the batch operation can be repeated (e.g., on the same set of samples—or on a set that includes at least some of the same samples as previous batches). One reason to repeat such processing is where, e.g., the collection of algorithmically generated domains is to be performed on a recurring basis (e.g., once a week) using all known DGA malware samples.

As mentioned above, static analysis can optionally be performed on the sample (e.g., at 404). At 406, a virtual machine instance is initialized, setting up the running environment for the malware to be tested (e.g., malware 130). As explained above, the hypervisor controlling the virtual machine instance can be customized to support “time interrupt” and “time polling” features. In addition, at 406, a specific time/date can be set within the virtual machine instance (i.e., the guest time can be set to a specific date and time). As one example, suppose the actual date and time that process 400 is performed is Jan. 1, 2014 (at one second after midnight). One reason to perform process 400 is to determine which domains a malicious sample will (when executed on a compromised client device) generate, at a future time, so that remedial actions (described in more detail below) can be taken before that future time arrives. So for example, while the analysis is performed on Jan. 1, 2014, one of the initializations that could be made (e.g., at 406) could be to set the guest date/time to Jan. 2, 2014 (or Jan. 3, 2014, etc.) at one second after midnight, or another appropriate time. The guest date/time can similarly be set in the past (e.g., to collect historical data on the malware's domain generation).

At 408, the virtual machine instance is started, and the candidate malware (e.g., malware sample 130) is executed in the virtual machine instance. The virtual environment is instrumented/hooked, as applicable, such that behaviors observed while the application is executing are logged. For example, a log is created of activities as they occur in the virtual machine instance (e.g., using a customized kernel that supports hooking and logcat). Further, network traffic associated with the virtual machine instance is captured (e.g., using pcap). As with the static analysis engine, the dynamic analysis engine stores the results of its analysis in database 316 in the record(s) associated with the application being tested (and/or includes the results in report 312 as applicable).

Any attempts at external contacts made by the virtual machine instance are recorded (e.g., at 410), along with the guest time at which the requests were made. As one example, DNS requests made by the virtual machine instance are recorded. The logged external contact attempts represent the domains that will be generated by malware 130 when executing on a compromised client at that future time. Another example of a connection attempt that can be collected at 410 is one using an IP address (e.g., where the malware is configured to algorithmically generate IP addresses instead of or in addition to domain names). In various embodiments, the attempts at external contacts (and the guest time at which they were made) are stored in database 316 (or another appropriate location) in a record associated with the malware sample being analyzed (e.g., keyed using a hash of the sample).

One countermeasure a malware author might employ, to try to defeat analysis by platform 300, is the use of an external time source. For example, instead of or in addition to polling a local time source for a current time (e.g., to use as a seed, or as a 500 second countdown timer), malware 130 might attempt to obtain a current time from a remote Network Time Protocol (NTP) server. The malware could use the NTP server's time source to generate domains (e.g., as a seed), ignoring any local time sources, or use the NTP server's response in combination with a local time. The malware could also use the existence of a discrepancy between the NTP server's reported time and a local time source as an indication that the malware is executing in a virtualized environment (i.e., is being analyzed for maliciousness) and stop executing (e.g., to avoid further scrutiny).

In various embodiments, system 300 includes an NTP server emulator. The emulator intercepts NTP requests (e.g., from malware 130 when executing on system 300) and responds with a fabricated time (e.g., that matches the current guest time). The emulator can be implemented in a variety of ways. As one example, the guest operating system's network stack can be modified to divert any NTP requests to the emulator. As another example, the emulator can be implemented as a traditional NTP server (but one modified to respond with times selected by system 300, as applicable). Other external time sources (e.g., using protocols other than NTP) can similarly be simulated.

In some cases, the external time source used by malware 130 might be a public time source (e.g., time.nist.gov). In other cases, the external time source might be under the control of the malware author (or a cohort). In various embodiments, system 300 (or another appropriate entity, as applicable), is configured to evaluate any NTP requests made by malware (such as malware 130) while executing in a virtual machine instance. In particular, any requests made of suspicious time sources (i.e., not to a well-known public source) can be flagged and used in other processing (e.g., added to one or more blacklists).

Remedial Actions

As explained above, a log of external contacts which malware sample 130 attempts to make (e.g., during dynamic analysis) is created (e.g., at 410). The list of external contact attempts (and times at which those contact attempts were attempted by the malware) can be used in a variety of ways. As a first example, the list can be provided to a DNS appliance (or appliance that includes a DNS module, such as DNS module 134). The DNS appliance/module can use the received list as a blacklist—refusing to resolve any requests made by a client (e.g., client 104) for a given blacklisted external contact (e.g., “2345smdjfui2345.com”).

Another example remedial use of the list is for a legitimate entity to register the domains on the received list. As explained above, malware authors often wait to register a C&C domain until shortly before the C&C domain is needed. So, for example, if domain “hc739xh23.net” will be used by a malware author on Feb. 7, 2014, the author might wait until Feb. 6, 2014 to register the domain. Using the techniques described herein, a security company (e.g., operating cloud security service 122) could analyze malware 130 (e.g., on Feb. 1, 2014—using a virtual machine instance with a guest time set to Feb. 7, 2014) and learn that malware 130 will generate the domain “hc739xh23.net” on Feb. 7, 2014. The security company could itself register “hc739xh23.net” (before the malware author does), preventing the malware author from using the domain. In various embodiments, the security company will make a server reachable at “hc739xh23.net,” set up a sinkhole, etc. The server can take a variety of actions, such as displaying a web page warning individuals that their computers have been compromised (but they are being protected by the security company). The server can also log any connection attempts to that server. The security company can use the logged connection attempts to the server it set up at “hc739xh23.net” for lead generation or other purposes.

Deduplicating Malware

Signature-based detection of malware is prevalent in the security industry, and in response malware authors are increasingly “repacking” their malware to thwart easy detection. In particular, malware authors will employ data obfuscation and other techniques that will result in programs that have identical (malicious) functionality (and are typically creating using identical source code) having very different executable files, which will yield very different signatures (e.g., different MD5, SHA-256, etc. signatures).

Suppose the author of malware 130 repacks the malware three times, sending different copies of malware 130 to each of clients 104, 106, and 108, respectively. The functionality of each copy will be the same (e.g., contact C&C server 150 and execute a cryptocurrency mining program), but to appliance 102, each copy appears to be a different attachment (i.e., each of the three files would have a respective different MD5 or other signature). Further suppose that appliance 102 does not have any signatures stored on it for any of the three received copies of malware 130 (i.e., the MD5 or other signatures of the three copies of malware 130 are not present on any blacklists or whitelists stored on appliance 102), and also that cloud security service 122 (when polled by appliance 102) also does not have any information pertaining to the three attachments. Appliance 102 might accordingly transmit each of the three attachments to cloud security service 122 for processing, before allowing the messages from system 120 to reach any of clients 104-108 (if at all). In this example, cloud security service 122 could wind up performing triple the work (i.e., performing a full set of static/dynamic analysis on each of the three copies of malware 130) than it otherwise would if the author had not employed repacking. In particular, if the author had not employed repacking, service 122 could have evaluated the first copy of malware 130 and reached a determination that the sample was malicious. Where the second and third samples are identical files (i.e., with identical signatures), service 122 would not need to examine the other two copies, and they would instead be flagged (e.g., by platform 102, or service 122, as applicable) as duplicates. However, the second and third copies, if repacked, will appear to be unique samples—and thus potentially require full analysis as well.

A variety of malware families employ domain generation algorithms, including Conficker, Murofet, BankPatch, Bonnana, and Bobax. As will be described in more detail below, the domains generated by DGA malware can be used as an alternate form of signature (i.e., instead of or in addition to a traditional MD5 or other cryptographic hash/signature). The DGA-based signature can be used to reduce the amount of time analysis of a given sample takes, and for other purposes.

Suppose a first malware sample undergoing analysis by system 300 (e.g., in accordance with portions of process 400) emits the following domains: “kjhdf2.com,” “238dj23.com,” “1jsd82.net,” and “sdkj23.org” (e.g., with a guest clock set to Mar. 1, 2014 at 01:00 at the start of the analysis). When a second sample (also executing in a virtual machine instance with a guest clock set to Mar. 1, 2014 at 01:00) also emits the domains: “kjhdf2.com,” “238dj23.com,” “1jsd82.net,” and “sdkj23.org,” an inference can be made that the first and second samples are the same malware (but have undergone repacking).

Once the second sample has been identified as a duplicate of the first sample (e.g., by a deduplication module 318, or coordinator 304, or another component, as applicable), a variety of actions can be taken. As a first example, additional processing of the second sample can be terminated, saving resources. As a second example, malware samples can be tied back to their sources (e.g., using database 316). For example, suppose the first and second samples are received (e.g., by cloud security service 122) from two different banking institutions. Using conventional signature-based approaches, the two samples would have two different signatures, and could potentially have been created by two different authors. Once it is discovered that the two samples use identical DGAs, an inference can be made that the author of both samples is the same (and, that the same entity is attacking both banks).

FIG. 5 illustrates an embodiment of a process for detecting duplicate malware samples. In various embodiments, process 500 is performed by system 300. The process begins at 502 when a first and second malware sample are received. As explained above, malware samples can be received in a variety of ways. In the following example, suppose the first and second malware sample are received at 502 as submissions from appliance 102. The two samples can be received in parallel and can also be received in sequence. Further, the samples can be received at two different times and from two different sources (e.g., with the first sample being provided by platform 102 and the second sample obtained from database 316 or another appliance, as applicable). Portions 504 and 506 of process 500 (described in more detail below) can be performed in parallel with one another, in sequence, or asynchronously.

At 504, a first virtual machine instance is initialized (e.g., in accordance with portion 406 of process 400) and the first malware sample is executed in that first virtual machine (e.g., in accordance with portion 408 of process 400). Any external contacts made by the virtual machine instance will be recorded (e.g., in accordance with portion 410 of process 400). And, as applicable, NTP or other network traffic can be emulated (e.g., using an NTP server emulator) or simulated. One example of portion 504 of process 500 is as follows. A first malware sample is executed in a first virtual machine instance (optionally configured to support the time interrupt/time polling customizations described above), with a starting guest time of Mar. 1, 2014 (at 01:00). The malware is allowed to continue executing for a set period of time (e.g., one day of guest time having elapsed), until a threshold number of external contact attempts have been made (e.g., ten domain names have been collected), or until another appropriate stopping point is reached. The external contact attempts made by the malware are stored, e.g. in database 316, in a manner that associates the generated domains (or IP addresses, as applicable) with the malware being evaluated (e.g., using one or more database entries).

At 506, portion 504 of process 500 is repeated, using the same virtual machine initializations, but with the second sample. An example of portion 506 of process 500 is as follows. The second malware sample is executed in a second virtual machine instance that has been configured the same way the first virtual machine instance was configured. Specifically, the starting guest time will also be set to Mar. 1, 2014 (at 01:00). And, if the time polling customizations described above were used in the environment the first sample was executed in, they are also used in the environment executing the second sample. The executing environment for both the first and second malware samples should thus appear identical to the two respective samples. As with the first malware sample, the external contact attempts by the second malware sample are stored, e.g., in database 316, in a manner that associates the generated domains (or IP addresses, as applicable) with the malware being evaluated. In various embodiments, any network traffic received by the first virtual machine is captured and replayed during the execution of the second virtual machine (instead of, for example, the second virtual machine receiving live network traffic). Suppose, for example, the first malware sample requests a page (e.g., the front page of yahoo.com) during execution. The page includes various live elements, like a current date/time, top stories, etc. During execution of the second malware sample, when the same request is made (e.g., the front page of yahoo.com), the data sent from yahoo.com to the first virtual machine is replayed for the second sample, instead of the second sample receiving a current copy of the page.

Finally, at 508, a determination is made as to whether or not the first and second sample are the same based on a comparison of their respective generated external contacts. The determination can be made in conjunction with portions 504/506 of process 500 (e.g., as part of a realtime analysis/determination). For example, one of the tasks performed by coordinator 304 can be to monitor additions as they are made to database 316, checking for evidence of duplicate malware samples by checking for an existing entry of an external contact attempt (i.e., associated with previously analyzed malware) when adding external contact attempts for a newly analyzed sample. Additions of external contact attempts can be added to database 316 as a given malware sample is being analyzed (i.e., in realtime, as a malware sample generates a new external contact it can be added to database 316), and also can be added as a batch after analysis of the sample ends.

The determination of 508 can also be made asynchronously with the processing performed at 504/506. For example, coordinator 304, or another component, such as a deduplicator 318 can periodically query database 316 for generated external contacts (e.g., once an hour or once a day) and determine whether multiple samples (whether a pair of samples, or more than two samples) share generated external contacts.

The operating environments the first and second malware samples are executing in are tightly controlled. Where both samples produce the same sequence of external contact attempts, an inference can be made that the first and second samples are the same. A variety of approaches can be used to determine similarity. As one example, a requirement can be imposed (e.g., by a rule configuration of deduplicator 318) that all external contact attempts made by both the first and second samples must be identical in order for the samples to be considered the same. As additional examples, a requirement can be imposed that a threshold number of external contact attempts (e.g., ten) be common across the first and second sample, a threshold percentage of external contact attempts (e.g., 75%) be common across the first and second sample, and/or a threshold number of external contact attempts (e.g., four) occur in a sequence (e.g., where the first sample has the sequence A, B, C, D, E, F, G, H, I and the second sample has the sequence, X, Y, Z, A, B, C, D . . . ). Further, in various embodiments, multiple thresholds are used to determine sameness. For example, results above a first threshold (e.g., above a 75% match or at least four identical external contact attempts in a row) can be used to flag two samples as being identical. Results below the first threshold but above a second threshold (e.g., 50-57% match or 2-3 identical external contact attempts in a row) can be used to flag two samples as being related.

In various embodiments, process 500 is performed using the same malware sample as both the first and second malware samples. This can be done, for example, as a quality assurance check—to ensure that two identical samples (namely, two identical copies of a given malware sample) generate identical external contact attempts. In the event the two identical copies generate different external contact attempts, this can be a sign that the domain generation algorithm used by the malware is engaging in anti-virtual machine or other techniques. This can also be a sign that platform 300 is misconfigured. An administrator (e.g., of platform 300) can be alerted that there is a potential problem with platform 300 in response to a determination being made (e.g., at 508) that two different sets of external contacts were generated when it was expected that the external contacts be the same.

Although the foregoing embodiments have been described in some detail for purposes of clarity of understanding, the invention is not limited to the details provided. There are many alternative ways of implementing the invention. The disclosed embodiments are illustrative and not restrictive. 

What is claimed is:
 1. A system, comprising: a processor; and a memory coupled with the processor and configured to provide the processor with instructions which when executed cause the processor to: set a first virtual guest clock to a first time value in a first virtual machine instance, and execute a first malware sample in the first virtual machine instance; set a second virtual guest clock to the first time value in a second virtual machine instance, and execute a second malware sample in the second virtual machine instance; perform a comparison of attempted domain contacts generated by executing each of the respective first and second malware samples; and determine that the first malware sample and second malware sample are related, based at least in part on a result of the comparison.
 2. The system of claim 1 wherein the memory is further configured to provide the processor with instructions which when executed cause the processor to record, for each attempted domain contact generated by executing the first malware sample in the first virtual machine instance, a time at which the attempt was made.
 3. The system of claim 1 wherein determining whether the first malware sample and the second malware sample are related includes determining that a threshold number of duplicate attempted domain contacts was generated by both the first malware sample and the second malware sample.
 4. The system of claim 1 wherein determining whether the first malware sample and the second malware sample are related includes determining that a threshold sequence of attempted domain contacts was generated by both the first malware sample and the second malware sample.
 5. The system of claim 1 wherein determining whether the first malware sample and the second malware sample are related includes employing a multi-level threshold.
 6. The system of claim 1 wherein the first and second malware samples are identical and wherein the determination is performed as a quality assurance check.
 7. The system of claim 1 wherein the first virtual machine instance comprises an accelerated computing environment.
 8. The system of claim 1 wherein the first virtual machine instance is selectively accelerated by a hypervisor configured to accelerate a virtual guest time using a time interrupt customization.
 9. The system of claim 1 wherein the first virtual machine instance is selectively accelerated by a hypervisor configured to accelerate a virtual guest time using a time polling customization.
 10. The system of claim 1 further comprising a network time protocol module configured to respond to the first virtual machine instance, when contacted by the first virtual machine instance, with a virtual guest time of the first virtual machine instance.
 11. The system of claim 1 wherein executing the second malware sample in the second virtual machine instance includes replaying network traffic collected during the execution of the first malware sample in the first virtual machine instance.
 12. The system of claim 1 wherein, in response to determining that the first malware sample and second malware sample are related, additional analysis that would otherwise have been performed on the second sample is not performed.
 13. A method, comprising: setting a first virtual guest clock to a first time value in a first virtual machine instance and executing a first malware sample in the first virtual machine instance; setting a second virtual guest clock to the first time value in a second virtual machine instance and executing a second malware sample in the second virtual machine instance; performing a comparison of attempted domain contacts generated by executing each of the respective first and second malware samples; and determining that the first malware sample and second malware sample are related, based at least in part on a result of the comparison.
 14. The method of claim 13, further comprising recording, for each attempted domain contact generated by executing the first malware sample in the first virtual machine instance, a time at which the attempt was made.
 15. The method of claim 13, wherein determining whether the first malware sample and the second malware sample are related includes determining that a threshold number of duplicate attempted domain contacts was generated by both the first malware sample and the second malware sample.
 16. The method of claim 13 wherein determining whether the first malware sample and the second malware sample are related includes determining that a threshold sequence of attempted domain contacts was generated by both the first malware sample and the second malware sample.
 17. The method of claim 13 wherein the first and second malware samples are the same and wherein the determination is performed as a quality assurance check.
 18. The method of claim 13 wherein the first virtual machine instance is selectively accelerated by a hypervisor configured to accelerate a virtual guest time using a time interrupt customization.
 19. The method of claim 13 wherein the first virtual machine instance is selectively accelerated by a hypervisor configured to accelerate a virtual guest time using a time polling customization.
 20. The method of claim 13 further comprising responding to the first virtual machine instance, when contacted by the first virtual machine instance, with a virtual guest time of the first virtual machine instance.
 21. The method of claim 13 wherein executing the second malware sample in the second virtual machine instance includes replaying network traffic collected during the execution of the first malware sample in the first virtual machine instance.
 22. The method of claim 13 wherein determining whether the first malware sample and the second malware sample are related includes employing a multi-level threshold.
 23. The method of claim 13 wherein, in response to determining that the first malware sample and second malware sample are related, additional analysis that would otherwise have been performed on the second sample is not performed. 